<%@page import="txdnet.util.DataUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
String htmlData = DataUtil.checkNull(request.getParameter("content1"), "");
%>
<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<title>KindEditor JSP</title>
	<link rel="stylesheet" href="ked/js/themes/default/default.css" />
	<link rel="stylesheet" href="ked/js/plugins/code/prettify.css" />
	<script charset="utf-8" src="ked/js/kindeditor-min.js"></script>
	<script charset="utf-8" src="ked/js/zh_CN.js"></script>
	<script charset="utf-8" src="ked/js/plugins/code/prettify.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content1"]', {
				cssPath : 'ked/js/plugins/code/prettify.css',
				uploadJson : 'ked/jsp/uper.jsp',
				fileManagerJson : 'ked/jsp/filemgr.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
				}
			});
			prettyPrint();
		});
                
                
                
                KindEditor.ready(function(K) {
				var editor = K.editor({
					fileManagerJson : 'ked/jsp/filemgr.jsp'
				});
				K('#filemanager').click(function() {
					editor.loadPlugin('filemanager', function() {
						editor.plugin.filemanagerDialog({
							viewType : 'VIEW',
							dirName : 'image',
							clickFn : function(url, title) {
								K('#url').val(url);
								editor.hideDialog();
							}
						});
					});
				});
			});
                        
                        
                        
                        	KindEditor.ready(function(K) {
				var editor = K.editor({
					allowFileManager : true,
                                        fileManagerJson : 'ked/jsp/filemgr.jsp'
				});
				K('#insertfile').click(function() {
					editor.loadPlugin('insertfile', function() {
						editor.plugin.fileDialog({
							fileUrl : K('#url2').val(),
							clickFn : function(url, title) {
								K('#url2').val(url);
								editor.hideDialog();
							}
						});
					});
				});
			});
                        
                        
                        KindEditor.ready(function(K) {
				var editor = K.editor({
					allowFileManager : true,
                                        uploadJson : 'ked/jsp/uper.jsp',
                                        fileManagerJson : 'ked/jsp/filemgr.jsp'
				});
				K('#image').click(function() {
					editor.loadPlugin('image', function() {
						editor.plugin.imageDialog({
							imageUrl : K('#url3').val(),
							clickFn : function(url, title, width, height, border, align) {
								K('#url3').val(url);
								editor.hideDialog();
							}
						});
					});
				});
			});



	</script>
</head>
<body>
	<%=htmlData%>
	<form name="example" method="post" action="ked.jsp">
            <textarea name="content1" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;"><%=DataUtil.parseTxt2Xml( htmlData)%></textarea>
		<br />
		<input type="submit" name="button" value="提交内容" /> (提交快捷键: Ctrl + Enter)
	</form>
                
                <br/>
                <input type="text" id="url" value="" /> <input type="button" id="filemanager" value="浏览服务器" />
                <br/>
                <input type="text" id="url2" value="" /> <input type="button" id="insertfile" value="选择文件" />
  <br/>
<input type="text" id="url3" value="" /> <input type="button" id="image" value="选择图片" />

</body>
</html>